<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
namespace Agp\CoreBundle\Manager;

use Agp\CoreBundle\Manager\BaseManager;
use Symfony\Component\Security\Acl\Permission\MaskBuilder;
use Symfony\Component\Security\Acl\Domain\ObjectIdentity;
use Symfony\Component\Security\Acl\Domain\UserSecurityIdentity;

/**
 * Description of PostComentarioManager
 *
 * @author bondcs
 */
class PostComentarioManager extends BaseManager{
    public function persist($entity) {
        
        parent::persist($entity);
        $aclManager = $this->container->get('problematic.acl_manager');
        $aclManager->setObjectPermission($entity, MaskBuilder::MASK_OWNER);
        
//        $aclProvider = $this->container->get('security.acl.provider');
//        $objectIdentity = ObjectIdentity::fromDomainObject($entity);
//        $acl = $aclProvider->createAcl($objectIdentity);
//
//        // retrieving the security identity of the currently logged-in user
//        $securityContext = $this->container->get('security.context');
//        $user = $securityContext->getToken()->getUser();
//        $securityIdentity = UserSecurityIdentity::fromAccount($user);
//
//        // grant owner access
//        $acl->insertObjectAce($securityIdentity, MaskBuilder::MASK_OWNER);
//        $aclProvider->updateAcl($acl);
        
    }
}

?>
